import {create} from 'zustand';
import {createSelectors} from '@/utils/zustandUtil.ts';

interface UseStore {
    bears: number;
    increasePopulation: () => void;
    removeAllBears: () => void;
    updateBears: (newBears: number) => void;
}

const useStore = create<UseStore>(set => ({
    bears: 0,
    increasePopulation: () => set(state => ({bears: state.bears + 1})),
    removeAllBears: () => set({bears: 0}),
    updateBears: newBears => set({bears: newBears}),
}));

export const useStoreSelector = createSelectors(useStore);
